<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>使用import函数实现按需加载</button>
    <script>
        document.querySelector("button").onclick = async function() {
           let res1=await import('./a.js');
           console.log(res1,'res1');
           let res2 =await import('./b.js');
           console.log(res2,"res2");
        }
    </script>
</body>
</html>